<template>
	<view class="add_peoples">
				<tm-form
				@submit="submit"
				ref="formData"
				@request="success"
				method="post">
					<tm-input name="title" required title="姓名" v-model="UCR02"></tm-input>
					<tm-input name="title" required title="手机号" v-model="UCR03"></tm-input>
					<tm-input name="title" required title="证件类型" disabled v-model="UCR04"></tm-input>
					<tm-input name="title" required title="证件号码" v-model="UCR05"></tm-input>
					<tm-pickersDate @confirm="chuchangchange" >
						<tm-input name="chuchangtime" required  title="驾照领取时间" placeholder="请选择驾照领取时间" disabled v-model="UCR06" right-icon="icon-angle-right"></tm-input>
					</tm-pickersDate>
					<view class="btn">
						
						<tm-button navtie-type="form" >确认保存</tm-button>
					</view>
			
				</tm-form>
				<tm-dialog v-model="show" :content="content"></tm-dialog>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				UCR02:'',//租车人姓名
				UCR03:'',//租车人手机号
				UCR04:'居民身份证',//租车人证件类型
				UCR05:'',//租车人证件号码
				UCR06:'',//租车人驾照领取时间
				show:false,
				content:''
			}
		},
		methods: {
			chuchangchange(e){
				this.UCR06=e.year+"-"+e.month+"-"+e.day
			},
			async submit(){
					const Rres = await  this.$wxRequest({
					url:'/wx/peoples_add',
					method:'POST',
					data:{
						UCR02:this.UCR02,
						UCR03:this.UCR03,
						UCR04:this.UCR04,
						UCR05:this.UCR05,
						UCR06:this.UCR06,
					}
				})
				if(Rres.data.code == 200){
					uni.navigateBack()
				}else{
					this.show=true
					this.content =Rres.data.msg
				}
			}
			
		}
	}
</script>

<style lang="scss" scoped>
.add_peoples{
	width: 100%;
	height: 100%;
.btn{
	text-align: center;
}
	
}
</style>
